#include<stdio.h>
int main()
{
	long A,B;
	scanf("%ld%ld",&A,&B);
	long yue(long a,long b);
	long bei(long a1,long b1);
	printf("%ld %ld\n",yue(A,B),bei(A,B));
}
long yue(long a,long b)
{
	long i1;
	{
	for(i1=a;i1>=1;i1--)
		if(b%i1==0&&a%i1==0)
			break;
	return i1;
	}
}
long bei(long a1,long b1)
{
	long i;
	for(i=a1;i>=1;i++)
		if((i%a1)==0&&(i%b1)==0)
			break;
	return i;
}
